#ffmpeg -i 1997.圆月弯刀.12-00.18.53.468-00.24.37.848.mkv -vf "crop=2816:2160:504:0" -c:v libx264 -crf 18 1997.圆月弯刀.mkv
#ffmpeg -i 1997.圆月弯刀.12-00.18.53.468-00.24.37.848.mkv -vf "crop=2816:2160:504:0" -c:a copy -crf 18 1997.圆月弯刀1.mkv

# ffmpeg -ss 20 -i 1983.射雕英雄传Ⅰ铁血丹心.10.mkv -t 10 -vf "cropdetect=24:16:0" -f null -
#ffmpeg -i 1997.圆月弯刀.12-00.18.53.468-00.24.37.848.mkv -vf "crop=2816:2160:504:0" -crf 18 1997.圆月弯刀1.mkv

# 寻秦记 "crop=1383:1080"
# 圆月弯刀 "crop=2816:2160:504:0"
# 1983.射雕英雄传Ⅰ铁血丹心.10.mkv "crop=928:704:174:4"

crop=$1
if [ -z "$crop" ]; then
    ffmpeg -nostdin -ss 20 -i 诡异列车.Ghost.Train.2025.mkv -t 10 -vf "cropdetect=24:16:0" -f null -
    exit
fi

[ -d ok ] || mkdir ok
count=1
find ./ -maxdepth 1 -type f | while read l; do
  ff="${l#./}"
  echo -e "\n$count -> $ff"
  ffmpeg -nostdin -y -i "$ff" -vf "$crop" -crf 18 ok/"$ff"
  let count++
done
